package com.atguigu.gulimall.order.config;

import java.util.Scanner;
import java.util.concurrent.ThreadLocalRandom;

public class abc {
    public static void main(String[] args) {


        int boom = ThreadLocalRandom.current().nextInt(100); // 生成 0 到 99 之间的随机整数
      System.out.println(boom);
        System.out.println("输入一个数");
        for (int i = 0; i < 5; i++) {
            int maxtemp = 0;
            int mintemp=0;
            Scanner scanner=new Scanner(System.in);
            int num=scanner.nextInt();
            int temp=0;
            while (num!=boom){

                if (num>boom){
                    maxtemp=num;
                    System.out.println("在"+mintemp+"到"+maxtemp);
                    System.out.println("继续猜：");
                    num = scanner.nextInt();
                    temp++;
                }else {
                    mintemp=num;
                    System.out.println("在"+mintemp+"到"+maxtemp);
                    System.out.println("继续猜：");
                    num = scanner.nextInt();
                    temp++;
                }
                if (temp==5){
                    System.out.println("猜错了"+boom);
                    break;
                }
            }

            if (num==boom){
                System.out.println("猜对了"+boom);
            }

        }
    }
}
